#include "Common.h"

int main()
{
    int wfd = open(FILENAME, O_RDWR);
    if (wfd < 0)
    {
        cerr << "errno:" << errno << ",errstring" << strerror(errno) << endl;
        return 1;
    }
    cout<<"open success\n";
    string msg;
    while (1)
    {
        cout << "Please Enter:\n";
        getline(cin, msg);
        ssize_t s = write(wfd, msg.c_str(), msg.size());
        if (s < 0)
        {
            cerr << "errno:" << errno << ",errstring" << strerror(errno) << endl;
            break;
        }
    }
    close(wfd);
    return 0;
}